from concurrent.futures import thread
import threading
import time
import queue

q = queue.Queue(4)


def f1():
    while 1:
        q.put(time.time())
        time.sleep(0.001)


def f2():
    while 1:
        t = q.get()
        print(time.time() - t)
        time.sleep(0.001)
    pass


t1 = threading.Thread(target=f1)
t2 = threading.Thread(target=f2)
t1.setDaemon(True)
t2.setDaemon(True)
t1.start()
t2.start()

while 1:
    time.sleep(1)
